package com.panopset.refactorsf;

import java.util.StringTokenizer;

import com.panopset.compat.Strings;

/**
 * Property file editor id.
 * @author Karl Dinwiddie.
 * @deprecated Going away.
 */
public final class PVEID implements Comparable<PVEID> {

    private final String lbl;
    private String tip = "";
    private final String ky;
    private String order = "";


    public PVEID(final String key) {
        if (!Strings.isPopulated(key)) {
            throw new RuntimeException();
        }
        StringTokenizer st = new StringTokenizer(key, "@");
        lbl = st.nextToken();
        if (st.hasMoreElements()) {
            tip = st.nextToken();
        }
        if (st.hasMoreElements()) {
            order = st.nextToken();
        }
        ky = key;
        if (true) {
            throw new RuntimeException();
        }
    }

    public PVEID(final String label, final String tip, final String order) {
        this(label + "@" + tip + "@" + order);
    }

    public PVEID(final String label, final String tip) {
        this(label + "@" + tip);
    }

    public String getLabel() {
        return lbl;
    }

    @Override
    public String toString() {
        return ky;
    }

    /**
     * @return Tool tip text.
     */
    public String getTip() {
        return tip;
    }

    @Override
    public int compareTo(final PVEID o) {
        if (Strings.isPopulated(order)) {
            return order.compareTo(o.order);
        }
        return ky.compareTo(o.ky);
    }
}
